pkgname=device-lg-hammerhead
pkgver=2
pkgrel=0
pkgdesc="Google Nexus 5"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="postmarketos-base linux-postmarketos-qcom mkbootimg mesa-dri-freedreno ofono"
makedepends=""
install="$pkgname.post-install"
subpackages="$pkgname-weston $pkgname-x11 $pkgname-nonfree-firmware:nonfree_firmware"
source="
	deviceinfo
	weston.ini
	xorg.conf
	modules-load.conf
	brcmfmac4339-sdio.txt
"
options="!check"

package() {
	install -Dm644 "$srcdir"/deviceinfo \
		"$pkgdir"/etc/deviceinfo
	install -D -m644 "$srcdir"/modules-load.conf \
		"$pkgdir"/etc/modules-load.d/00-${pkgname}.conf
	install -D -m644 "$srcdir"/brcmfmac4339-sdio.txt \
		"$pkgdir"/lib/firmware/brcm/brcmfmac4339-sdio.txt
}

x11() {
	install_if="$pkgname xorg-server"
	depends="
		libinput
		xf86-input-libinput
		xf86-video-fbdev"
	install -Dm644 "$srcdir"/xorg.conf \
		"$subpkgdir"/etc/X11/xorg.conf.d/10-hammerhead.conf
}

weston() {
	install_if="$pkgname weston"
	install -Dm644 "$srcdir"/weston.ini \
		"$subpkgdir"/etc/xdg/weston/weston.ini
}

nonfree_firmware() {
	pkgdesc="Wifi, GPU, Modem and ADSP firmware"
	depends="linux-firmware-qcom linux-firmware-brcm firmware-adreno firmware-lg-hammerhead-adsp firmware-lg-hammerhead-modem modem-qcom-msm-mainline-common"
	mkdir "$subpkgdir"
}

sha512sums="c101c0de0f0799bd0d78303f3dc13da74b54369df89ddd85f75e11ef3122f8a4ba8c3543c640a27eb079e9c3afceafec7958c7427abe914b3409ca1430a00f61  deviceinfo
4c22070223f39c419260a6817e5cc2b7881c095deeba031363a5634842dd175dd67eecace980849f0553de79110ef4e43a66143d71433805cd916c37fe7248e9  weston.ini
f86ef35730b89bcc8160c08db7a7fcd0970adf60c0b77af68bac397de49c0d1783e6b8db1762380c9bf874aff2d030c6f44ecb75c803d69e79ede11376409369  xorg.conf
d8ce60ea7acaabf627ddca2f0887a4cda46f313b7aaf7934bef2fef8a6e0798ccefab849e4571e4e3fcd06ae34c1a6efe3b58b401e2e443416f6200e6d4ea769  modules-load.conf
59baf815a45c632f3413dc8d9f48978f91d8f8ee165003689dcd54cc3b3d1af65bfc0c88f76579f840b83b303a28a1de2c2994a651d62cc6f6d8988c8716e345  brcmfmac4339-sdio.txt"
